<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Order Notes Preview</title>
	<link href="./css/default.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="./js/jsx.js"></script>
	<script type="text/javascript" src="./js/jsml.js"></script>
	<script type="text/javascript" src="./js/ui.js"></script>
	<script type="text/javascript" src="./js/ris.js"></script>
	<script type="text/javascript" src="./js/SR.js"></script>
	<script type="text/javascript" src="./js/preview.js"></script>
	<script type="text/javascript" src="./JDMI/js/preview.js"></script>
	<script type="text/javascript" >
		var errorProvider = new ErrorProvider();
		var imagePath = "./images";

		function onBodyLoad()
		{
			if(!Ris)
				return;

			var context = Ris.getHealthcareContext();
			if (context == null)
			{
				Field.setValue($("myForm"), "");
				return;
			}
			
			var orderNotes = context.OrderNotes.map(function(n) { return n.NoteDetail; });
			// initialize an array of boolean check states to false
			var checkStates = orderNotes.map(function(n) { return false; });

			Field.show($("noConversationSection"), !orderNotes || orderNotes.length == 0);
							
			var orderNotesSubsections = 
				[
					{category:"PrelimDiagnosis", subsectionHeading:"Preliminary Diagnosis"}
				];

			var checkBoxesProperties =
				{
					onItemChecked: function(item, checked) 
						{
							var index = orderNotes.indexOf(item);
							checkStates[index] = checked;
							Ris.setTag("NotesAcknowledged", JSML.create(checkStates, "checkStates")); 
						},
					showItemCheckBox: function(item) { return item.CanAcknowledge; }
				};
				
			Preview.ConversationHistory.create($("conversationHistorySection"), orderNotes, orderNotesSubsections, true, checkBoxesProperties);
		}
	</script>
	<style>
		body {
			margin:0 0em 0 0em;
			padding:0;
		}
		#conversationHistorySection tr {
			vertical-align:top;
			margin-top: 0;
		}
		#noConversationSection {
			font-family: Tahoma, Geneva, Arial;
			font-size: 150%;
			font-weight: bold;
			color: #CCCCCC;
			text-align:center;
			margin-top:3em;
		}
	</style>
</head>
<body onload="javascript: onBodyLoad()">
	<form id="myForm">

	<div id="noConversationSection">No Notes</div>
	<div id="conversationHistorySection"></div>

	</form>
</body>
</html>